package com.lcf.framework.feign;

import com.lcf.common.dto.DictTableDTO;
import com.lcf.feign.service.DictTableDynamicFeignClient;
import com.lcf.framework.utils.DictTableUtils;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

import static com.lcf.base.constant.SysConstant.DICT_TABLE_DYNAMIC_FEIGN_PATH;

/**
 * 表翻译
 *
 * @author lcf
 */
@Hidden
@RequestMapping(DICT_TABLE_DYNAMIC_FEIGN_PATH)
@RestController
public class DictTableDynamicFeignClientImpl implements DictTableDynamicFeignClient {
    @Resource
    private DictTableUtils dictTableUtils;

    /**
     * 执行动态表查询并返回主键映射结构
     */
    @Override
    @PostMapping("tableMapping")
    public Map<String, Map<String, Object>> queryTableMapping(@RequestBody DictTableDTO dictTable) {
        return dictTableUtils.queryTableMapping(dictTable);
    }
}
